import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'
// import Left from '../views/Left.vue'
// import Center from '../views/Center.vue'

// import Right from '../views/Right.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'home',
      component: HomeView,
	  meta:{
		  showNav:true
	  },
	 //  components:{
		// default:Left,
		// ce:Center,
		// ri:Right
	 //  }
	  
    },
    {
      path: '/about',
      name: 'about',
      // route level code-splitting
      // this generates a separate chunk (About.[hash].js) for this route
      // which is lazy-loaded when the route is visited.
      component: () => import('../views/AboutView.vue'),
	  meta:{
	  		  showNav:true
	  }
    },
	{
		path:"/goods",
		name:"goods",
		component:()=>import("../views/GoodsView.vue"),
		meta:{
				  showNav:true
		}
	},
	{
		path:"/user/:id",
		name:"user",
		component:()=>import("../views/User.vue"),
		//redirect:"/user/111/add",
		redirect:(route)=>{
			return '/user/'+route.params.id+"/add"
		},
		children:[
			{
				path:"add",
				component:()=>import("../views/AddUser.vue"),
				meta:{
						  showNav:true
				}
			},
			{
				path:"remove",
				component:()=>import("../views/RemoveUser.vue"),
				meta:{
						  showNav:true
				}
			},
			
		]
	},
	{
		path:"/car",
		name:'car',
		component:()=>import("../views/Car.vue"),
		redirect:"/car/add",
		children:[
			{
				path:"/car/add",
				component:()=>import("../views/AddCar.vue"),
				meta:{
						  showNav:true
				}
			},
			{
				path:"/car/list",
				component:()=>import("../views/CarList.vue"),
				meta:{
						  showNav:true
				}
			},
		]
	},
	{
		path:"/search",
		name:"search",
		component:()=>import("../views/Search.vue"),
		meta:{
				  showNav:false
		}
		
	},
  ],
})



export default router
